home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Equivalents / roman-converter.izs < prev    next >
Text File  |  2005-09-28  |  6KB  |  309 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Roman Numeral Converter
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>This script will convert arabic numerals to roman numerals!<!/DESCRIPTION> 
  7.  
  8. <!CATEGORY>Equivalents<!/CATEGORY>
  9.  
  10. <!SCRIPT>
  11. <!-- START OF SCRIPT -->
  12.  
  13. <!-- HOW TO INSTALL ROMAN NUMERAL CONVERTER:
  14.  
  15.  
  16.  
  17.   1.  Copy code into the HEAD section of document
  18.  
  19.   2.  Put last coding into the BODY section of document  -->
  20.  
  21.  
  22.  
  23. <!-- STEP ONE: Add code into HEAD section of document  -->
  24.  
  25.  
  26.  
  27. <HEAD>
  28.  
  29.  
  30.  
  31. <!-- Original:  Ben Joffe () -->
  32.  
  33. <!-- Web Site:  http://www.joffe.tk/ -->
  34.  
  35. <script>
  36.  
  37. function romanise(){
  38.  
  39. var persian=numeral.value;
  40.  
  41. var roman="";
  42.  
  43. var ronumdashes="";
  44.  
  45.  
  46.  
  47. var buffer=10-persian.length;
  48.  
  49. while (buffer>0) {persian="0"+persian;buffer--}
  50.  
  51.  
  52.  
  53. var units=new Array("","I","II","III","IV","V","VI","VII","VIII","IX");
  54.  
  55. var tens=new Array("","X","XX","XXX","XL","L","LX","LXX","LXXX","XC");
  56.  
  57. var hundreds=new Array("","C","CC","CCC","CD","D","DC","DCC","DCCC","CM");
  58.  
  59. var thousands=new Array("","M","MM","MMM","MV","V","VM","VMM","VMMM","MX");
  60.  
  61.  
  62.  
  63. var billionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
  64.  
  65. romandashes=billionsdashes[persian.substring(0,1)];
  66.  
  67.  
  68.  
  69. var hundredmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
  70.  
  71. romandashes+=hundredmillionsdashes[persian.substring(1,2)];
  72.  
  73.  
  74.  
  75. var tenmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
  76.  
  77. romandashes+=tenmillionsdashes[persian.substring(2,3)];
  78.  
  79.  
  80.  
  81. var millionsdashes=new Array("","_","__","___","_=","=","=_","=__","=___","_=");
  82.  
  83. romandashes+=millionsdashes[persian.substring(3,4)];
  84.  
  85.  
  86.  
  87. var hundredthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
  88.  
  89. romandashes+=hundredthousandsdashes[persian.substring(4,5)];
  90.  
  91.  
  92.  
  93. var tenthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
  94.  
  95. romandashes+=tenthousandsdashes[persian.substring(5,6)];
  96.  
  97.  
  98.  
  99. var thousandsdashes=new Array("","","",""," _","_","_","_","_"," _");
  100.  
  101. romandashes+=thousandsdashes[persian.substring(6,7)];
  102.  
  103.  
  104.  
  105. roman=thousands[persian.substring(0,1)];
  106.  
  107. roman+=hundreds[persian.substring(1,2)];
  108.  
  109. roman+=tens[persian.substring(2,3)];
  110.  
  111. roman+=thousands[persian.substring(3,4)];
  112.  
  113. roman+=hundreds[persian.substring(4,5)];
  114.  
  115. roman+=tens[persian.substring(5,6)];
  116.  
  117. roman+=thousands[persian.substring(6,7)];
  118.  
  119. roman+=hundreds[persian.substring(7,8)];
  120.  
  121. roman+=tens[persian.substring(8,9)];
  122.  
  123. roman+=units[persian.substring(9,10)];
  124.  
  125.  
  126.  
  127. result.innerHTML=romandashes+"<br>"+roman+"<p><a href=http://www.evrsoft.com/>http://www.evrsoft.com</a><br>by Ben Joffe";
  128.  
  129. }
  130.  
  131. </script>
  132.  
  133. </HEAD>
  134.  
  135.  
  136.  
  137. <!-- STEP TWO: Add code into BODY section of document  -->
  138.  
  139.  
  140.  
  141. <BODY>
  142.  
  143.  
  144. <!-- Original:  Ben Joffe () -->
  145.  
  146. <!-- Web Site:  http://www.joffe.tk/ -->
  147.  
  148. <p><input type="text" name=numeral size="10" onKeypress="if (event.keyCode<48 || event.keyCode>57) event.returnValue=false;" maxlength="10"><input type="button" value="Convert" onclick="romanise()"></p>
  149.  
  150. <tt id=result style=font-size:14pt>Enter a numeral into the box to have it converted into Roman Numerals
  151.  
  152. <br><br>
  153.  
  154.  
  155. <!-- END OF SCRIPT -->
  156. <!/SCRIPT>
  157.  
  158. <!PREVIEW>
  159. <!-- START OF SCRIPT -->
  160.  
  161.  
  162. <!-- HOW TO INSTALL ROMAN NUMERAL CONVERTER:
  163.  
  164.  
  165.  
  166.   1.  Copy code into the HEAD section of document
  167.  
  168.   2.  Put last coding into the BODY section of document  -->
  169.  
  170.  
  171.  
  172. <!-- STEP ONE: Add code into HEAD section of document  -->
  173.  
  174.  
  175.  
  176. <HEAD>
  177.  
  178.  
  179.  
  180. <!-- Original:  Ben Joffe () -->
  181.  
  182. <!-- Web Site:  http://www.joffe.tk/ -->
  183.  
  184. <script>
  185.  
  186. function romanise(){
  187.  
  188. var persian=numeral.value;
  189.  
  190. var roman="";
  191.  
  192. var ronumdashes="";
  193.  
  194.  
  195.  
  196. var buffer=10-persian.length;
  197.  
  198. while (buffer>0) {persian="0"+persian;buffer--}
  199.  
  200.  
  201.  
  202. var units=new Array("","I","II","III","IV","V","VI","VII","VIII","IX");
  203.  
  204. var tens=new Array("","X","XX","XXX","XL","L","LX","LXX","LXXX","XC");
  205.  
  206. var hundreds=new Array("","C","CC","CCC","CD","D","DC","DCC","DCCC","CM");
  207.  
  208. var thousands=new Array("","M","MM","MMM","MV","V","VM","VMM","VMMM","MX");
  209.  
  210.  
  211.  
  212. var billionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
  213.  
  214. romandashes=billionsdashes[persian.substring(0,1)];
  215.  
  216.  
  217.  
  218. var hundredmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
  219.  
  220. romandashes+=hundredmillionsdashes[persian.substring(1,2)];
  221.  
  222.  
  223.  
  224. var tenmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
  225.  
  226. romandashes+=tenmillionsdashes[persian.substring(2,3)];
  227.  
  228.  
  229.  
  230. var millionsdashes=new Array("","_","__","___","_=","=","=_","=__","=___","_=");
  231.  
  232. romandashes+=millionsdashes[persian.substring(3,4)];
  233.  
  234.  
  235.  
  236. var hundredthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
  237.  
  238. romandashes+=hundredthousandsdashes[persian.substring(4,5)];
  239.  
  240.  
  241.  
  242. var tenthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
  243.  
  244. romandashes+=tenthousandsdashes[persian.substring(5,6)];
  245.  
  246.  
  247.  
  248. var thousandsdashes=new Array("","","",""," _","_","_","_","_"," _");
  249.  
  250. romandashes+=thousandsdashes[persian.substring(6,7)];
  251.  
  252.  
  253.  
  254. roman=thousands[persian.substring(0,1)];
  255.  
  256. roman+=hundreds[persian.substring(1,2)];
  257.  
  258. roman+=tens[persian.substring(2,3)];
  259.  
  260. roman+=thousands[persian.substring(3,4)];
  261.  
  262. roman+=hundreds[persian.substring(4,5)];
  263.  
  264. roman+=tens[persian.substring(5,6)];
  265.  
  266. roman+=thousands[persian.substring(6,7)];
  267.  
  268. roman+=hundreds[persian.substring(7,8)];
  269.  
  270. roman+=tens[persian.substring(8,9)];
  271.  
  272. roman+=units[persian.substring(9,10)];
  273.  
  274.  
  275.  
  276. result.innerHTML=romandashes+"<br>"+roman+"<p><a href=http://www.evrsoft.com/>http://www.evrsoft.com</a><br>by Ben Joffe";
  277.  
  278. }
  279.  
  280. </script>
  281.  
  282. </HEAD>
  283.  
  284.  
  285.  
  286. <!-- STEP TWO: Add code into BODY section of document  -->
  287.  
  288.  
  289.  
  290. <BODY>
  291.  
  292.  
  293. <!-- Original:  Ben Joffe () -->
  294.  
  295. <!-- Web Site:  http://www.joffe.tk/ -->
  296.  
  297. <p><input type="text" name=numeral size="10" onKeypress="if (event.keyCode<48 || event.keyCode>57) event.returnValue=false;" maxlength="10"><input type="button" value="Convert" onclick="romanise()"></p>
  298.  
  299. <tt id=result style=font-size:14pt>Enter a numeral into the box to have it converted into Roman Numerals
  300.  
  301. <br><br>
  302.  
  303.  
  304.  
  305. <!-- END OF SCRIPT -->
  306. <!/PREVIEW>
  307.  
  308. <!RELATED>NONE<!/RELATED>
  309.